
#include "sise.h"
#include "sise_packer.h"

#include <stdio.h>

int main(int argc, char* argv[])
{
	const int BUF_SIZE = 100;
	char *hex1 = "124D0C1476A941C179D274E7";
	char bin1[BUF_SIZE];
	char bin2[BUF_SIZE];
	char hex2[BUF_SIZE];
	short s1, s2;
	float f1, f2;
	int i1, i2;
	double d1, d2;
	
	sise_nullify(hex2, BUF_SIZE);
	sise_nullify(bin1, BUF_SIZE);
	sise_nullify(bin2, BUF_SIZE);
	
	s1 = 2847;
	sise_var2bin_short(bin1, &s1);
	sise_bin2short(bin1, &s2);
	printf("s1 = %d\n", s1);
	printf("s2 = %d\n", s2);
	printf("bin1 = %s\n", bin1);
	
	i1 = 28472398;
	sise_var2bin_int(bin1, &i1);
	sise_bin2int(bin1, &i2);
	printf("i1 = %d\n", i1);
	printf("i2 = %d\n", i2);
	printf("bin1 = %s\n", bin1);
	
	f1 = 2847.401231237f;
	sise_var2bin_float(bin1, &f1);
	sise_bin2float(bin1, &f2);
	printf("f1 = %.10f\n", f1);
	printf("f2 = %.10f\n", f2);
	printf("bin1 = %s\n", bin1);
	
	d1 = 2847.401231237927989;
	sise_var2bin_double(bin1, &d1);
	sise_bin2double(bin1, &d2);
	printf("d1 = %.15f\n", d1);
	printf("d2 = %.15f\n", d2);
	printf("bin1 = %s\n", bin1);
	
	printf("sizeof(char) = %d\n", sizeof(char));
	printf("sizeof(short) = %d\n", sizeof(short));
	printf("sizeof(int) = %d\n", sizeof(int));
	printf("sizeof(long) = %d\n", sizeof(long));
	printf("sizeof(float) = %d\n", sizeof(float));
	printf("sizeof(double) = %d\n", sizeof(double));
	
	return 0;
}
